<template>
<div>
    <el-dialog 
        title="分享取消" 
        :visible.sync="$store.state.unshare_dialog" 
        append-to-body
        width="400px">
        <div class="container">
            <div class="left">
                <i class="el-icon-warning"></i>
            </div>
            <div class="right">
                <div class="top">
                    确定要拒绝接受该分享？
                </div>
                <div class="bottom">
                    拒绝接受该分享后此链接将立即失效
                </div>
            </div>
        </div>
        <div slot="footer" class="dialog_footer">
            <el-button type="primary" @click="on_unshare">确 定</el-button>
            <el-button @click="on_cancel">取 消</el-button>
        </div>
    </el-dialog>
</div>
</template>

<script> 
export default {   //取消文件分享对话框
    components:{},
    data() {
        return {
        };
    },
    methods: {
        on_unshare(){ //放弃该分享执行方法
            this.$store.commit('set_loading',{
                state:true,
                msg:'请稍后',
            });
            let fileId = this.$store.state.selection_files.map(item=>{
                return item.fileId;
            })
            this.$axios.json_post('shared/delrecept',{
                fileId:fileId.join(','),
                fileType:0,
            }).then(({msg})=>{
                for(let a of this.$store.state.selection_files.map(item=>{
                    return item.hadoopFileName;
                })){
                    setTimeout(() => {
                        this.$store.commit('add_unshare_file',{
                            file:{
                                name:a,
                            },
                            msg:msg,
                            state:'success',
                        });
                    },0);
                }
                this.$store.state.update_data = !this.$store.state.update_data;
                this.$store.commit('set_unshare_dialog',false);
            }).finally(()=>{
                this.$store.commit('set_loading',{
                    state:false,
                });
            });
        },
        on_cancel(){ //取消按钮点击事件
            this.$store.commit('set_unshare_dialog',false);
        },
    }
};
</script>
<style lang="scss" scoped>
.container{
    width:100%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    height: fit-content;
    margin-bottom: 20px;
    >.left{
        font-size: 40px;
        color: #2980ff;
        margin-right: 20px;
    }
    >.right{
        >.top{
            font-size: 16px;
            color: #000;
            margin-bottom: 5px;
        }
        >.bottom{
            font-size: 14px;
            color: #868686;
        }
    }
}
/deep/.dialog_footer{
    /deep/button{
        width: 90px;
        height: 35px;
        border-radius: 2px;
    }
}
</style>